<?php

declare(strict_types=1);

namespace App\CustHub\Request;

use Mine\MineFormRequest;

class RoomPresetRequest extends MineFormRequest
{
    public function saveRules(): array
    {
        return [
            'name' => 'required|string|max:255',
            'room_name_keyword_match_type' => 'sometimes|integer|in:0,1',
            'room_name_keywords' => 'sometimes|json',
            'room_tag_match_type' => 'sometimes|integer|in:0,1,2',
            'room_tags' => 'sometimes|json',
            'role' => 'sometimes|json',
            'min_members' => 'sometimes|integer|min:0',
            'max_members' => 'sometimes|integer|min:0|gte:min_members',
        ];
    }

    public function getInfoRules(): array
    {
        return [
            'id' => 'required',
        ];
    }

    public function updateRules(): array
    {
        return array_merge(['id' => 'required'], $this->saveRules());
    }

    public function deleteRules(): array
    {
        return [
            'ids' => 'required'
        ];
    }
}